/**
 * [ 路由组件 ]
 */
import React                   from 'react'
import {Redirect,Switch,Route} from 'react-router-dom'

//递归遍历子路由
export default props => <Switch>
    {
        props.routers.map((item,key)=>item.to?<Redirect key={key} from={item.from} to={item.to}/>:<Route key={key}  path={item.path} render={routes=> <item.component {...routes} routers={item.children} />}/>)
    }
</Switch>
    
